#include "StdAfx.h"

#include "ProcParamString.h"

const char * const ProcParamString::BadValue = "[badvalue]";

ProcParamString::ProcParamString(int Index, const char *Name, IPluginICProcStepsParam::Direction dir, const char *Value)	: 
	ProcParam(Index, Name, dir)
{
	 _valStr = (Value != '\0') ? Value : ProcParamString::BadValue;
}


ProcParamString::ProcParamString(const ProcParamString *param) : 
	ProcParam(param)
{

}


ProcParamString::~ProcParamString(void)
{
}

long MXSTDMETHOD ProcParamString::DestroyPtr(void)
{
	long cnt = InterlockedDecrement(&_refCnt);
	if ( cnt == 0 )
		delete this;
	return cnt;
}

long MXSTDMETHOD ProcParamString::DuplicatePtr(void)
{
	return InterlockedIncrement(&_refCnt);
}

void *MXSTDMETHOD ProcParamString::Dynamic_cast(const char *IId)
{
	void *rc = '\0';

	if (IId != '\0')
	{
		if (strncmp (IPluginICProcStepsParamStringIID::GUID(), IId, IMxPluginBaseIID::IIdSize) == 0)
			rc = static_cast<IPluginICProcStepsParamString *>(this);
		else if (strncmp (IMxPluginBaseIID::GUID(), IId, IMxPluginBaseIID::IIdSize) == 0)
			rc = static_cast<IMxPluginBase *>(this);
		else
			rc = '\0';

		if (rc != '\0')
			((IMxPluginBase *)rc)->DuplicatePtr();
	}
	return rc;
}

//-------------------------------------------------------------------------------------------------
//			E N D   O F   F I L E
//-------------------------------------------------------------------------------------------------
